package com.tools.ad.adscene.inner;

import android.os.Message;
import android.view.View;

import com.hm.adsbuisiness.utils.AdUtils;
import com.hm.adsui.card.CommonNativeAdCardView;
import com.hm.base.android.mob.AMApplication;
import com.tools.ad.AdType;
import com.tools.ad.EntranceType;
import com.tools.ad.R;
import com.tools.ad.ui.crad.view.LandingCardView;

/**
 * Landing广告场景
 * Created by wen.yu.gang on 2018/7/6
 */
public class LandingScene extends CommonScene {
    public LandingScene(AMApplication context, EntranceType entranceType) {
        super(context, entranceType);
    }


    @Override
    protected CommonNativeAdCardView initCardView() {
        return new LandingCardView(imContext);
    }

    @Override
    public View getAdView() {
        View adView = super.getAdView();
        if (adView instanceof LandingCardView) {
            if (!AdUtils.isFaceBook(activeAd)) {
                View connerLayout = adView.findViewById(R.id.conner_layout);
                if (connerLayout != null) {
                    connerLayout.setVisibility(View.GONE);
                }
            }
        }
        return adView;
    }

    @Override
    protected void onADLoaded(AdType adType) {
        Message message = Message.obtain();
        message.what = R.id.msg_ad_landing_scene_loaded;
//        message.arg2 = adType;
        message.obj = mEntranceType.getName();
        imContext.handleMobMessage(message);
    }
}
